import request from "../config/request.js";
import host from "../config/host";

const getCertificateList = function(params, success) {
  request.defaults({
    method: "get",
    url: host.pcHostUrl + "/wx/certificate/list",
    params,
    success
  });
};

const getCertificateDetail = function(params, success) {
  request.defaults({
    method: "get",
    url: host.pcHostUrl + "/wx/certificate/detail",
    params,
    success
  });
};

// 安全检查

const getCheckSecurityRecordList = function(params, callback) {
  request.postData(
    host.pcHostUrl + `/wx/checkSecurityRecord/getCheckSecurityRecordList`,
    params,
    callback
  );
};

const getMyCheckSecurityRecordList = function(params, callback) {
  request.postData(
    host.pcHostUrl + `/wx/checkSecurityRecord/getMyCheckSecurityRecordList`,
    params,
    callback
  );
};
const getCheckSecurityRecordDetails = function(params, callback) {
  request.postData(
    host.pcHostUrl + `/wx/checkSecurityRecord/details`,
    params,
    callback
  );
};

const postCheckSecurityRecord = function(params, callback) {
  request.postData(
    host.pcHostUrl + `/wx/checkSecurityRecord/submit`,
    params,
    callback
  );
};

// 安全检查隐患

const getCheckTroubleList = function(params, callback) {
  request.postData(
    host.pcHostUrl + `/wx/checkTrouble/getCheckTroubleList`,
    params,
    callback
  );
};

const getCheckTroubleListByRecordId = function(
  checkSecurityRecordId,
  callback
) {
  request.getData(
    host.pcHostUrl +
      `/wx/checkTrouble/getCheckTroubleList/${checkSecurityRecordId}`,
    callback
  );
};
const getCheckTroubleDetails = function(id, callback) {
  request.getData(host.pcHostUrl + `/wx/checkTrouble/details/${id}`, callback);
};
const deleteCheckTrouble = function(id, callback) {
  request.getData(host.pcHostUrl + `/wx/checkTrouble/delete/${id}`, callback);
};

const getMyCheckTroubleList = function(params, callback) {
  request.postData(
    host.pcHostUrl + `/wx/checkTrouble/getMyCheckTroubleList`,
    params,
    callback
  );
};

const postCheckTrouble = function(params, callback) {
  request.postData(
    host.pcHostUrl + `/wx/checkTrouble/submit`,
    params,
    callback
  );
};

const postCheckTroubleHandle = function(params, callback) {
  request.postData(
    host.pcHostUrl + `/wx/checkTroubleHandle/troubleHandle`,
    params,
    callback
  );
};

const postUpdateTroubleStatus = function(params, callback) {
  request.postData(
    host.pcHostUrl + `/wx/checkTrouble/updateTroubleStatus`,
    params,
    callback
  );
};

const getTypeNum = function(params, callback) {
  request.postData(
    host.pcHostUrl + `/wx/checkSecurityRecord/getTypeNum`,
    params,
    callback
  );
};

const getCheckTroubleNumCharts = function(params, callback) {
  request.postData(
    host.pcHostUrl + `/wx/checkSecurityRecord/getCheckTroubleNum`,
    params,
    callback
  );
};

const getCheckStandardItemNumCharts = function(params, callback) {
  request.postData(
    host.pcHostUrl + `/wx/checkSecurityRecord/getCheckStandardItemNum`,
    params,
    callback
  );
};

const getCheckSecurityRecordNumCharts = function(params, callback) {
  request.postData(
    host.pcHostUrl + `/wx/checkSecurityRecord/getCheckSecurityRecordNum`,
    params,
    callback
  );
};
// 检查计划
const getCheckSecurityRecordDepList = function(params, callback) {
  request.postData(
    host.pcHostUrl + `/wx/checkSecurityRecord/getCheckSecurityRecordDepList`,
    params,
    callback
  );
};

const getCheckSecurityRecordUserList = function(params, callback) {
  request.postData(
    host.pcHostUrl + `/wx/checkSecurityRecord/getCheckSecurityRecordUserList`,
    params,
    callback
  );
};

const getcheckSecurityRecordDepTabNum = function(params, callback) {
  request.postData(
    host.pcHostUrl + `/wx/checkSecurityRecord/getcheckSecurityRecordDepTabNum`,
    params,
    callback
  );
};

const getcheckSecurityRecordUserTabNum = function(params, callback) {
  request.postData(
    host.pcHostUrl + `/wx/checkSecurityRecord/getcheckSecurityRecordUserTabNum`,
    params,
    callback
  );
};

// 风险管控
const getCheckStandardRiskRankDepList = function(params, callback) {
  request.postData(
    host.pcHostUrl + `/wx/checkStandard/getCheckStandardRiskRankDepList`,
    params,
    callback
  );
};

const getCheckStandardRiskRankUserList = function(params, callback) {
  request.postData(
    host.pcHostUrl + `/wx/checkStandard/getCheckStandardRiskRankUserList`,
    params,
    callback
  );
};

const getCheckStandardRiskRankDepNum = function(params, callback) {
  request.postData(
    host.pcHostUrl + `/wx/checkStandard/getCheckStandardRiskRankDepNum`,
    params,
    callback
  );
};

const getCheckStandardRiskRankUserNum = function(params, callback) {
  request.postData(
    host.pcHostUrl + `/wx/checkStandard/getCheckStandardRiskRankUserNum`,
    params,
    callback
  );
};

const getCheckStandardRiskRankDetails = function(id, callback) {
  request.getData(
    host.pcHostUrl + `/wx/checkStandard/getDetails/${id}`,
    callback
  );
};

const postCheckStandardItemSubmit = function(params, callback) {
  request.postData(
    host.pcHostUrl + `/wx/check-standard-item-record/submit`,
    params,
    callback
  );
};

const getCheckStandardItemRecordDetails = function(id, callback) {
  request.getData(
    host.pcHostUrl + `/wx/check-standard-item-record/details/${id}`,
    callback
  );
};

const getListByCheckStandardItemId = function(params, callback) {
  request.postData(
    host.pcHostUrl +
      `/wx/check-standard-item-record/getListByCheckStandardItemId`,
    params,
    callback
  );
};

const getTroubleListByCheckStandardItemId = function(params, callback) {
  request.postData(
    host.pcHostUrl + `/wx/check-standard-item-record/getListByType`,
    params,
    callback
  );
};

const getCheckStandardItemRecordList = function(params, callback) {
  request.postData(
    host.pcHostUrl + `/wx/check-standard-record/getList`,
    params,
    callback
  );
};

const getCheckStandardItemRecordItemList = function(
  checkStandardRecordId,
  callback
) {
  request.getData(
    host.pcHostUrl +
      `/wx/check-standard-item-record/getListByCheckStandardRecordId/${checkStandardRecordId}`,
    callback
  );
};

const postCheckStandardRecordSubmit = function(id, callback) {
  request.getData(
    host.pcHostUrl + `/wx/check-standard-record/submit/${id}`,
    callback
  );
};

const getCheckStandardItemDetails = function(id, callback) {
  request.getData(
    host.pcHostUrl + `/pc/checkStandardItem/details/${id}`,
    callback
  );
};

const postCheckStandardItemNoPlanSubmitSubmit = function(data, callback) {
  request.postData(
    host.pcHostUrl + `/wx/check-standard-item-record/noPlanSubmit`,
    data,
    callback
  );
};

const getCheckTroubleTypeNum = function(data, callback) {
  request.postData(
    host.pcHostUrl + `/wx/checkTrouble/getTypeNum`,
    data,
    callback
  );
};

const getCheckTroubleTypeDepNum = function(data, callback) {
  request.postData(
    host.pcHostUrl + `/wx/checkTrouble/getTypeDepNum`,
    data,
    callback
  );
};

const getCheckStandardPowerById = function(checkStansardItemId, callback) {
  request.getData(
    host.pcHostUrl +
      `/wx/check-standard-item-record/getPowerById/${checkStansardItemId}`,
    callback
  );
};

// 安全作业审批

const postSafeExamine = function(data, callback) {
  request.postData(host.pcHostUrl + `/wx/safeExamine/add`, data, callback);
};

const getSafeExamine = function(data, callback) {
  request.postData(host.pcHostUrl + `/wx/safeExamine/getById`, data, callback);
};

const getSafeExamineList = function(data, callback) {
  request.postData(host.pcHostUrl + `/wx/safeExamine/list`, data, callback);
};
const getSafeExamineApprovedList = function(data, callback) {
  request.postData(host.pcHostUrl + `/wx/safeExamine/approvedExamine`, data, callback);
};
const getSafeExamineMyList = function(data, callback) {
  request.postData(host.pcHostUrl + `/wx/safeExamine/myExamine`, data, callback);
};
const getSafeExaminePendingList = function(data, callback) {
  request.postData(host.pcHostUrl + `/wx/safeExamine/pendingExamine`, data, callback);
};

const getSafeExamineStateNum = function(data, callback) {
  request.postData(
    host.pcHostUrl + `/wx/safeExamine/getStateNum`,
    data,
    callback
  );
};

const postSafeExamineSignature = function(data, callback) {
  request.postData(
    host.pcHostUrl + `/wx/safeExamine/signature`,
    data,
    callback
  );
};

const putSafeExamine = function(data, callback) {
  request.postData(host.pcHostUrl + `/wx/safeExamine/update`, data, callback);
};

export default {
  getCertificateList,
  getCertificateDetail,
  getCheckSecurityRecordList,
  getMyCheckSecurityRecordList,
  getCheckSecurityRecordDetails,
  postCheckSecurityRecord,
  getCheckTroubleList,
  getMyCheckTroubleList,
  getCheckTroubleListByRecordId,
  getCheckTroubleDetails,
  postCheckTrouble,
  postCheckTroubleHandle,
  deleteCheckTrouble,
  postUpdateTroubleStatus,
  getTypeNum,
  getCheckTroubleNumCharts,
  getCheckStandardItemNumCharts,
  getCheckSecurityRecordNumCharts,
  getCheckSecurityRecordDepList,
  getCheckSecurityRecordUserList,
  getcheckSecurityRecordDepTabNum,
  getcheckSecurityRecordUserTabNum,
  getCheckStandardRiskRankDepList,
  getCheckStandardRiskRankUserList,
  getCheckStandardRiskRankDepNum,
  getCheckStandardRiskRankUserNum,
  getCheckStandardRiskRankDetails,
  postCheckStandardItemSubmit,
  getCheckStandardItemRecordDetails,
  getCheckStandardItemDetails,
  getListByCheckStandardItemId,
  getTroubleListByCheckStandardItemId,
  getCheckStandardItemRecordList,
  getCheckStandardItemRecordItemList,
  postCheckStandardRecordSubmit,
  postCheckStandardItemNoPlanSubmitSubmit,
  getCheckTroubleTypeNum,
  getCheckTroubleTypeDepNum,
  getCheckStandardPowerById,
  postSafeExamine,
  putSafeExamine,
  getSafeExamine,
  getSafeExamineList,
  getSafeExamineApprovedList,
  getSafeExaminePendingList,
  getSafeExamineMyList,
  getSafeExamineStateNum,
  postSafeExamineSignature
};
